﻿//创建时间: 2010-10-11
//创建作者: 李晓忠
//功能说明: CMS系统 结点信息
//最后修改: 2010-10-13 李晓忠 添加删除结点和子结点功能  
//最后修改: 2010-10-14 李晓忠 添加结点树  
//最后修改: 2010-10-28 李晓忠 移动结点 MoveNodeToNewParentId          
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Reflection;

using TRPOP.Common;
using TRPOP.CMS.Model;

namespace TRPOP.CMS.DALFactory
{
    public interface INodeDAL
    {

        ///	<summary>
        ///	保存
        ///	</summary>
        ///	<param name="NodeInfo"></param>
        ///	<returns>EnumSubmitResult</returns>
        EnumSubmitResult Save(NodeInfo info);

        ///	<summary>
        ///	获取实体
        ///	</summary>
        ///	<param name="nodeId"></param>
        ///	<returns>NodeInfo</returns>
        NodeInfo GetInfoById(int id);

        ///	<summary>
        ///	删除
        ///	</summary>
        ///	<param name="id"></param>
        ///	<returns>EnumSubmitResult</returns>
        EnumSubmitResult DeleteInfoById(int id);

        ///	<summary>
        ///	删除
        ///	</summary>
        ///	<param name="ids"></param>
        ///	<returns>EnumSubmitResult</returns>
        EnumSubmitResult DeleteInfoByIds(string ids);


       
        /// <summary>
        /// 删除结点和子结点
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        EnumSubmitResult DeleteNodeAndChildrenById(int id);
        
       
        ///	<summary>
        ///	自定义列表（无分页）
        ///	</summary>
        ///	<param name="topn">前N条，为0时表示所有符合条件的</param>
        ///	<param name="condition">自定义条件，要以And开头</param>
        ///	<param name="orderby">排序，不需要Order by </param>
        ///	<returns>List<NodeInfo></returns>
        List<NodeInfo> GetListByCondition(int topn, string condition, string orderby);

        ///	<summary>
        ///	自定义列表（分页）
        ///	</summary>
        ///	<returns>List<NodeInfo></returns>
        List<NodeInfo> GetListByPager(int pageNumber, int pageSize, string condition, string orderby, out int recordCount);

        
       /// <summary>
        /// 结点树形结构
       /// </summary>
       /// <param name="ParentId"></param>
       /// <param name="level"></param>
       /// <param name="Condition"></param>
       /// <returns></returns>
        List<NodeInfoWithLevel> GetNodeListTree(int ParentId, int level, string Condition);

        /// <summary>
        /// 移动结点
        /// </summary>
        /// <param name="nodeid">结点</param>
        /// <param name="parentId">父结点</param>
        /// <returns></returns>
        EnumSubmitResult MoveNodeToNewParentId(int nodeid, int parentId);

         /// <summary>
        /// 获取结点下所有子结点(保含子结点的子结点)
        /// </summary>
        /// <param name="ParentID"></param>
        /// <returns></returns>
        List<NodeInfo> GetNodeListByParentID(int ParentID);

        /// <summary>
        /// 更新附件表里的地址
        /// </summary>
        /// <param name="strNodeID"></param>
        /// <param name="strOld"></param>
        /// <param name="strNew"></param>
        /// <returns></returns>
        EnumSubmitResult ResetAllPSN(string strNodeID, string strOld, string strNew);
    }


    public sealed partial class DataAccess
    {
        public static INodeDAL CreateNodeDAL()
        {
            string className = path + ".NodeDAL";
            return (INodeDAL)Assembly.Load(path).CreateInstance(className);
        }
    }
}
